package com.xucy.springboot.dao;

import com.xucy.springboot.entity.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.List;

@RepositoryRestResource(path = "student")
public interface StudentDao extends JpaRepository<Student, Long> {

    List<Student> findByName(String name);

    @Query(value = "select * from td_student t where t.name=?1", nativeQuery = true)
    List<Student> findByLastName(String name);

}
